#ifndef GLOBAL_H
#define GLOBAL_H

#include "crossbit/common.h"
#include <map>
#include <set>
#include <vector>

namespace crossbit
{

    class TBlock;
    class VBlock;

    class GLOBAL{
        public:
            static XTUint32 last_exit;
            volatile static XTUint32 return_address;
            // for trace linking
            static TBlock* tblock_stub;
            static VBlock* vblock_stub;

            // assume there is at most 10000 indirect enter.
            static XTMemAddr  indirect_link_stub[10000];
            static XTUint32   indirect_link_index;   
            //static const XTMemAddr STACK_BASE = 0x7FFFFFF0;
            static const XTMemAddr STACK_BASE = 0x40000000;

            //Added by suntingtao 
            //The max number of block number in a super block chain
            static const XTUint32 MAX_BLOCK_CHAIN_NUM = 31;
            //The threshold of a basic block , if it runs more than this value , it is
            //considered to be a head of a super block
            static const XTUint32 THRESHOLD = 3000;
            static XTUint8 BUILD_SUPER_BLOCK;
            static XTUint32 total_mediate;
            static XTUint32 total_call;
            static XTUint32 total_instruction;
            static XTUint32 total_ld_st;
            static XTUint32 total_mem;

			// Added by zhangyichao
			static std::map< XTMemAddr, std::vector< XTMemAddr > > ma_ld_info;
			static std::map< XTMemAddr, std::vector< XTMemAddr > > ma_st_info;

    };	
}

#endif
